<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "order_evaluate".
 *
 * @property int $id
 * @property int $order_id 订单id
 * @property int $user_id 用户id
 * @property int $good_id 商品id
 * @property int $star 综合评分
 * @property int $star_good 商品评分
 * @property int $star_service 服务评分
 * @property string $content 评价内容
 * @property int $status 状态
 * @property int $created_at 创建时间
 */
class OrderEvaluate extends Base
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'order_evaluate';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['order_id', 'user_id', 'good_id', 'star', 'star_good', 'star_service', 'status', 'created_at'], 'integer'],
            [['content'], 'string'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'order_id' => 'Order ID',
            'user_id' => 'User ID',
            'good_id' => 'Good ID',
            'star' => 'Star',
            'star_good' => 'Star Good',
            'star_service' => 'Star Service',
            'content' => 'Content',
            'status' => 'Status',
            'created_at' => 'Created At',
        ];
    }

    public function getUser(){
        return $this->hasOne(User::class, ['id' => 'user_id']);
    }
}
